﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml.Linq;

namespace Qcy.Jshj.Web.Helpers
{
    public class XmlHelper
    {
        private XDocument Document;

        public XmlHelper(string path)
        {
            Document = XDocument.Load(path);
        }

        public XElement GetXElements(string tagName)
        {
            var element = Document.Root.Elements().FirstOrDefault(s => string.Equals(s.Attribute("Name").Value, tagName, StringComparison.InvariantCultureIgnoreCase));
            if (element != null)
                return element;
            throw new NotImplementedException();
        }
    }
}